-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🌱 Remove the dependency on cluster-api/utils from addons API #9482
🌱 Remove the dependency on cluster-api/utils from addons API #9482
Conversation
// removeOwnerRef returns the slice of owner references after removing the supplied owner ref. | ||
// Note: removeOwnerRef ignores apiVersion and UID. It will remove the passed ownerReference where it matches Name, Group and Kind. | ||
// | ||
// Deprecated: This function is deprecated and will be removed in an upcoming release of Cluster API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied these functions over from the util package. We only have to keep them until the next release and then we can remove these funtions.
@@ -196,7 +196,12 @@ func (r *ClusterResourceSetReconciler) reconcileDelete(ctx context.Context, clus | |||
return err | |||
} | |||
|
|||
clusterResourceSetBinding.DeleteBinding(crs) | |||
clusterResourceSetBinding.RemoveBinding(crs) | |||
clusterResourceSetBinding.OwnerReferences = util.RemoveOwnerRef(clusterResourceSetBinding.GetOwnerReferences(), metav1.OwnerReference{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the ownerReferences handling into the controller which makes more sense to me and means we don't have to keep a copy of the ownerRef handling code in the addons v1beta1 package.
@JoelSpeed I think this should cut down the import list of the addons package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
One question though, how do we prevent regressions of the transitive deps in the API repos? Can the import restrictions tool look at transitive dependencies at all?
LGTM label has been added. Git tree hash: ba3dc5bfc537164131a50df5a2bebc9b497f52c9
|
This should hopefully prevent the transitive dependencies coming back once this PR is merged, PTAL |
One way we could do this is to have a "verification go module" in our repo just like the one you have.
(I hope it works with relative require statements in go.mod) Maybe a bit hacky, but maybe not too bad and good enough for what we want (and it basically simulates 100% e2e what we want to ensure / what users end up with) |
Yeah adding a verification module could work, but you're right it's a bit hacky. I wonder if there's a way to extend the import boss tool to verify dependent modules as well. Will do a bit of research |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth adding a new .import-restrictions file?
} | ||
} | ||
|
||
// TODO(killianmuldoon): Remove this code in a future release. This is now duplicated in the controller. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not already removing it now (only for this new function) when already introducing a new function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that - it was from me going over and back on how to handle the deprecation 🤦
Signed-off-by: killianmuldoon <[email protected]>
ec26284
to
3b9b48b
Compare
I think it would be better to try to pursue something which can catch indirect dependencies - otherwise we'll have a mess of restrictions across the codebase IMO. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
LGTM label has been added. Git tree hash: fdf5b7c8bcb6ba82e009b377a3c597e249dcb7e5
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: killianmuldoon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Remove the dependency on
cluster-api/util
from the addons API package. This removes a large set of dependencies for importers of that API.Part of #9011
/area api